//
//  AboutMe.m
//  ArtCircle
//
//  Created by sunbin on 2017/5/21.
//  Copyright © 2017年 HuaYue. All rights reserved.
//

#import "AboutMe.h"

#import "AboutMeCell.h"
#import "AboutMeLabelCell.h"

#import "AboutMeHeaderCell.h"

@interface AboutMe ()

@end

@implementation AboutMe
{
    NSArray *cellAry;
    NSArray *contAry;

    ACUserModel *model ;
}
- (void)viewDidLoad {
    [super viewDidLoad];


    self.title = @"个人资料";
    

    cellAry = @[@"昵称",@"性别",@"艺圈人ID",@"星座",@"常驻区",@"个性标签" ,@"我的职业",@"我的标签"];
    
    model = [[YConfig sharedYConfig] searchData];
    
    
    contAry = @[IF_NULL_TO_STRING(model.nickname),
                SEESEX(model.sex) ,
                IF_NULL_TO_STRING(model.getnewid),
                IF_NULL_TO_STRING(model.constellation),
                IF_NULL_TO_STRING(model.permanentregion),
                IF_NULL_TO_STRING(model.personalsignature),
                IF_NULL_TO_STRING(model.job),
                IF_NULL_TO_STRING(model.label),

                ];
    
    [self.tableView registerNib:[UINib nibWithNibName:@"AboutMeCell" bundle:nil] forCellReuseIdentifier:@"AboutMeCellID"];
    [self.tableView registerNib:[UINib nibWithNibName:@"AboutMeLabelCell" bundle:nil] forCellReuseIdentifier:@"AboutMeLabelCellID"];

    [self.tableView registerNib:[UINib nibWithNibName:@"AboutMeHeaderCell" bundle:nil] forCellReuseIdentifier:@"AboutMeHeaderCellID"];
    
    
    self.tableView.tableFooterView = [[UITableViewHeaderFooterView alloc] initWithFrame:CGRectZero];
    
}



#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return cellAry.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
   return indexPath.row == 0 ?[self cellForRowAtIndexPath:indexPath AboutMeHeaderCellForTableView:tableView]:(indexPath.row < 5?
                                                                                                              [self cellForRowAtIndexPath:indexPath AboutMeCellForTableView:tableView]:
                                                                                                              [self cellForRowAtIndexPath:indexPath AboutMeLabelCellForTableView:tableView]);

}

- (AboutMeHeaderCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath AboutMeHeaderCellForTableView:(UITableView *)tableView{

    AboutMeHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AboutMeHeaderCellID" forIndexPath:indexPath];
    
    return cell;

}

- (AboutMeCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath AboutMeCellForTableView:(UITableView *)tableView{
    AboutMeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AboutMeCellID" forIndexPath:indexPath];
    
    cell.textLab.text = cellAry[indexPath.row];
    cell.content.text = contAry[indexPath.row];
    
    return cell;

}
- (AboutMeLabelCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath AboutMeLabelCellForTableView:(UITableView *)tableView{

    AboutMeLabelCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AboutMeCellID" forIndexPath:indexPath];
    cell.textLab.text = cellAry[indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
    [self.navigationController pushViewController:kVCFromSb(@"FIXNickNameID", @"StaticTableViewController") animated:YES];

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return indexPath.row == 0?84.f:57.f;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
